import java.util.Scanner;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User: Administrator
 * Data: 2023 - 10 - 15
 * Time: 10:48
 */
//牛客 求最大连续bit数
public class Solution10 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int n = in.nextInt();
            int count = 0, maxCount = 0;
            while (n != 0) {
                if((n & 1) == 1) {
                    count++;
                    maxCount = Math.max(count, maxCount);
                }else {
                    count = 0;
                }
                n >>= 1;
            }
            System.out.println(maxCount);
        }
    }
}
